package com.fht.controller.member;

import com.fht.entity.MemberCategory;
import com.fht.entity.MemberSet;
import com.fht.entity.MerchantsInformation;
import com.fht.service.food.MerchantsInformationService;
import com.fht.service.member.MemberSetService;
import com.fht.util.ResultVOUtil;
import com.fht.vo.ResultVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@Slf4j
@RequestMapping("/member/set")
public class MemberSetController {

    @Autowired
    public MemberSetService memberSetService;


    //菜品类别展示
    @GetMapping("/index")
    public String index(Model model){

        MemberSet memberSet = memberSetService.selectById(2019000);

        model.addAttribute("memberSet",memberSet);

        return "member/set/index";

    }

    //修改map缓存中的数据，并重新计算价格总和
    @PostMapping("/edit")
    @ResponseBody
    public ResultVO edit (MemberSet memberSet){

        memberSetService.update(memberSet);

        return ResultVOUtil.ok();
    }

}
